home *** CD-ROM | disk | FTP | other *** search
- /*
- @Node Header
- @Next Macro
-
- Code: ami2d.rexx
- Author: Russell Leighton
- Revision: 16 Feb 1994
-
- Comments:
-
- This script sets up Ami2D to be used interactivily. It may be executed
- directly from the command line or by double clicking on the Ami2D icon.
- The script executes Ami2D and calls other scripts to setup rexxcon and
- rexxbar. It then goes into an infinite loop which continuously issues a
- read command to rexxcon to obtain commands typed into rexxcon's window.
- These commands are in turn issued to Ami2D. However, if the command starts
- with a ! then the command is issued to the command line (AmigaDOS)
- instead. Also if the command is stop then the loop is exitted and all
- tasks are stopped. If for some reason this script fails then the tasks
- will not be properly terminated. If this occurs then the script
- cleanup.rexx should be executed to force termination of remaining tasks.
-
- @EndNode
- @Node Macro
- */
-
- options results
-
- if ~show('l', "rexxarplib.library") then do
- check = addlib('rexxarplib.library',0,-30,0)
- end
-
- call pragma('stack',50000)
-
- address command
-
- 'assign ami2d: /ami2d'
-
- /* For WShell (CNC: device), the next line should be uncommented */
-
- /* 'dhopts menu ami2d:rexx/ami2d-menus name ami2d' */
-
- if ~show('ports', "AMI2D") then do
- 'run ami2d:bin/ami2d ami2d:rexx/init'
- 'waitforport AMI2D'
- end
-
- /* The following line will open the Ami2D screen in
- whatever mode the Workbench is set at */
-
- address ami2d 'open'
-
- /* The following line will force the Ami2D screen to
- open in the PICASSO:1024x768 mode */
-
- /* address ami2d 'open(-68,-50,PICASSO:1024x768)' */
-
- /* The following line will force the Ami2D screen to
- open in the "NTSC:High Res Laced" mode */
-
- /* address ami2d 'open(0,0,"NTSC:High Res Laced")' */
-
- if rc > 0 then do
- address ami2d 'why'
- if length(result) > 0 then say result
- exit
- end
-
- /* call 'ami2d:rexx/rexxbar' */
- call 'ami2d:rexx/mainbar'
- call 'ami2d:rexx/geombar'
- call 'ami2d:rexx/helpbar'
- call 'ami2d:rexx/rexxcon'
-
- address rxb_ami2d 'open'
- parse var result ix iy iw ih
-
- address ami2d 'open('0 - iw',-50)'
-
- error:
- signal on error
-
- do forever
- address rxc_ami2d 'read'
- comm = result
- if comm = 'stop' then leave
- if index(comm,'!cd') = 1 then do
- if length(pragma('directory',substr(comm,5))) = 0 then iterate
- end
- n = index(comm,"!")
- if n = 1 then do
- if length(comm) = 1 then do
- comm = GetFile(,,,,"select macro","AMI2D","PATGAD",,,,"#?.rexx")
- if length(comm) = 0 then iterate
- end
- else comm = substr(comm,2)
- comm '>pipe:ami2d'
- call open('ami2d','pipe:ami2d','R')
- do while ~eof('ami2d')
- line = readln('ami2d')
- if length(line) ~= 0 then address rxc_ami2d 'write("'line'")'
- end
- call close('ami2d')
- end
- else do
- address ami2d comm
- if rc > 0 then address ami2d 'why'
- if length(result) > 0 then address rxc_ami2d 'write("'result'")'
- end
- end
-
- call postmsg
- if show('ports',"RXB_MAIN") then address rxb_main 'stop'
- if show('ports',"RXB_AMI2D") then address rxb_ami2d 'stop'
- if show('ports',"RXB_HELP") then address rxb_help 'stop'
- if show('ports',"RXC_AMI2D") then address rxc_ami2d 'stop'
- if show('ports', "NLN2D") then address nln2d 'stop'
- address ami2d 'stop'
-
- /* For WShell (CNC: device), the next line should be uncommented */
-
- /* 'dhopts delete ami2d' */
-
- exit
-